# coding:utf-8
# author:frank
# date:2024/12/30
import pygame

pygame.init()

window = pygame.display.set_mode((400,600))
# 1.创建字体对象Font(字体文件路径,字号,不支持中文的字体无法显示文字内容)
font = pygame.font.Font("files/Serendity.ttf",34)
# 2.创建文字对象render(内容,True,文字颜色,[背景颜色])
text = font.render('Hello',True,"#ff0000")
# 3.渲染到窗口
window.blit(text,(0,0))
# 4.获取文字尺寸
w,h=text.get_size()
window.blit(text,(400-w,600-h))
# 5.缩放和旋转
t1 = pygame.transform.scale(text,(100,100))
window.blit(t1,(0,100))
t2 = pygame.transform.rotozoom(text,90,1.5)
window.blit(t2,(0,200))
# 刷新
pygame.display.flip()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit()